<template>
  <template v-for="(item, index) in dialogState.dialogArr" :key="index">
    <template v-if="item.show">
      <div
        class="order_dialog"
        :style="{ left: item.position.x + 'px', top: item.position.y + 'px', zIndex: item.zindex }"
        :ref="setDialogRef(item, index)"
        @click="dialogStore.clickOrderDialog(item)"
      >
        <DialogHeader :data="item" :dataindex="index" />
        <DialogContent :data="item" :dataindex="index" :pkindex="item.pkindex" />
      </div>
    </template>
  </template>
</template>
  

<script setup>
import DialogHeader from './dialog_com/DialogHeader.vue'
import DialogContent from './dialog_com/DialogContent.vue'
const { dialogStore, dialogState } = inject('DialogStore')

const setDialogRef = (item, index) => {
  return el => {
    if (el) {
      // 在这里更新item.ref，绑定DOM元素
      item.ref = el
    }
  }
}
</script>

<style lang="scss" scoped>
.order_dialog {
  position: absolute;
  min-width: 400px;
  max-width: 1110px;
  min-height: 300px;
  background: #fff;
  box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
}
</style>

<style>
.order_dialog .el-select__wrapper,
.order_dialog .el-select {
  height: 24px !important;
  line-height: 24px !important;
  min-height: 24px;
  font-size: 12px;
  font-family: AlibabaPuHuiTi_2_55_;
  font-size: 12px;
  background-color: #f3f5fd;
  border: none;
  border-radius: 0;
}
.order_dialog .el-select__wrapper {
  padding: 4px 6px;
}

.order_dialog .el-select__wrapper.is-focused {
  border: none !important;
  box-shadow: none !important;
}
.order_dialog .el-input__wrapper.is-focus,
.order_dialog .el-input__wrapper {
  background-color: #f3f5fd;
  border-color: #f3f5fd !important;
  box-shadow: none;
  padding: 4px 6px;
  font-size: 12px;
}
</style>